/**
 * 
 */
package com.cqan.controller;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;

import com.cqan.entity.account.User;
import com.cqan.orm.PropertyFilter;

/**
 * @author wuhui
 * 
 *         下午02:16:46
 */
public class BaseController {

	protected Logger logger = Logger.getLogger("sl.debug");

	/**
	 * 
	 * 获取登陆用户信息
	 * @return
	 */
	protected User getUserDetails() {
		Object obj = SecurityContextHolder.getContext().getAuthentication() .getPrincipal();
		if (obj instanceof User) {
			return (User) obj;
		}
		return null;
	}
	
	
	protected String getBasePath(HttpServletRequest request){
		String path = request.getContextPath();
		return request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
	}
}
